package com.ruoyi.web.controller;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.system.domain.PubBlog;
import com.ruoyi.system.service.IPubBlogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/web/blog")
public class WebBlogController extends BaseController {

    @Autowired
    private IPubBlogService pubBlogService;

    /**
     * 获取博客 列表
     */
    @GetMapping("/list")
    public TableDataInfo list(PubBlog pubBlog)
    {
        startPage();
        List<PubBlog> list = pubBlogService.selectPubBlogList(pubBlog);
        return getDataTable(list);
    }

    /**
     * 获取博客详细信息
     */
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(pubBlogService.selectPubBlogById(id));
    }









}
